# script 'UpdateSolution.ps1'

Write-Host 
# define variables for script
$PackagePath = "..\bin\Debug\Expertime.Multitude.Intranet.wsp"
$PackageName = "Expertime.Multitude.Intranet.wsp"

# check to ensure Microsoft.SharePoint.PowerShell is loaded
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null) {
Write-Host "Loading SharePoint Powershell Snapin"
Add-PSSnapin "Microsoft.SharePoint.Powershell"
}

# Update SPSolution
Write-Host 
Write-Host "Updating Solution :"  -foregroundcolor Magenta
Write-Host "- Package		 = " $PackageName -foregroundcolor Magenta
Update-SPSolution -Identity $PackageName -LiteralPath $PackagePath -GACDeployment -Force -Verbose

# display site info
Write-Host 
Write-Host "Solution updated successfully" -foregroundcolor Green